import { Divider, Button } from 'antd';
import React from 'react';
import FuncComp from './funcCom';
import ClassComp from './classComp';

export default function LifeCycleComp() {
  const [number, setNumber] = React.useState(0);
  const handleClick = () => {
    setNumber(number + 1);
  };
  return (
    <div className="lifecycle">
      <p>lifecycle</p>
      <Button onClick={handleClick}>+</Button>
      <Divider />
      <FuncComp />
      <Divider />
      {number === 2 ? null : <ClassComp number={number} />}
    </div>
  );
}
